<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./vue.js"></script>
</head>

<body>
    
    <div id="app" @click="myclick">
        <p v-for="arr in array">{{arr}}</p>
        <p>{{obj.sex}}</p>
        <!-- v-on省略写法 @ -->
        <button @click="changeStatus">click me to change picture status</button>
        <br>
        <br>
        <!-- v-show 操纵样式display 需要频繁操作的元素使用v-show -->
        <img v-bind:src="imgSrc[0]" v-show="isShow" />
        <br>
        <!-- v-if 操纵dom直接删除或添加元素 不需要频繁操作的元素使用v-if -->
        <!-- v-bind省略写法 : -->
        <img :src="imgSrc[1]" v-if="isShow" />
    </div>

    <script>

        let myarray = ["jack","jim","tom"];
        let myobj = {
            name: "lily",
            age: 18,
            sex: "female"
        };

        let app = new Vue({
            el: "#app",
            data: {
                array: myarray,
                obj: myobj,
                isShow: true,
                imgSrc: [
                    "./LOL原画/腥红之月伊芙琳.jpg",
                    "./LOL原画/卡莎 KDA.jpg"
                ]
            },
            methods: {
                myclick: function(e) {
                    console.log("click is available");
                    console.log(this);
                },
                changeStatus: function(e) {
                    this.isShow = !this.isShow;
                }
            }
        });

    </script>
</body>
</html>